package com.itheima.advance.reflect.demo04;

import java.lang.reflect.Method;

public class ReflectDemo01 {

    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {

        Class studentClass = Class.forName("com.itheima.advance.reflect.demo04.Student");

        Method[] methods = studentClass.getMethods();
        for (Method method : methods){
            System.out.println(method);
        }
        System.out.println("----------------------------");

        Method[] declaredMethods = studentClass.getDeclaredMethods();
        for (Method method : declaredMethods){
            System.out.println(method);
        }
        System.out.println("-------------------------------");

        Method function2 = studentClass.getMethod("function2", String.class);
        System.out.println(function2);
        Method function4 = studentClass.getMethod("function4", String.class);
        System.out.println(function4);
        System.out.println("----------------------------------");

        Method show = studentClass.getDeclaredMethod("show");
        System.out.println(show);
        Method function3 = studentClass.getDeclaredMethod("function3");
        System.out.println(function3);
    }
}
